
use ../Data/Clean/cleaned_recruiter_data.dta, clear
global screener_ctrl screenerisfemale screeneriswhite screenerisblack priorscreeningexperience screenerhourlyrateamount incalifornia  nocurassignments s_sourcer s_talent s_humanres_cat s_compensation s_human_resource s_human_resources s_recruiter s_recruiting s_sourcing s_staffing s_talent_acquisition totalactualhoursbille noactualhoursbilled nocurassignments  nofeedback norevenue avgfeedbackscore curassignments 


***********************************************
***** Table 1: RECRUITER CHARACTERISTICS ******
***********************************************

global myopts "prehead(\begin{tabular}{l*{6}{c}}) postfoot(\end{tabular}) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"
estpost ci screenerisfemale screeneriswhite screenerisblack priorscreeningexperience screenerhourlyrateamount totalhours2 if randomfirstcandidate==1, listwise 
esttab using ../Output/Tables/Table01.tex, $myopts label replace nostar cell("b(f(2)) se(f(2)) lb(f(2)) ub(f(2))") collabels("Mean" "SD" "Lower 95\% CI" "Upper 95\% CI") 

****************************************************************
***** Table 2: DESCRIPTIVE STATISTICS: RECRUITER FEEDBACK ******
****************************************************************

global myopts "prehead(\begin{tabular}{l*{6}{c}}) postfoot(\end{tabular}) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"
estpost ci interview pacceptinterview ppassinterview pacceptjoboffer phire has_comment, listwise 
esttab using ../Output/Tables/Table02.tex, $myopts label replace nostar cell("b(f(2)) se(f(2)) lb(f(2)) ub(f(2))") collabels("Mean" "SD" "Lower 95\% CI" "Upper 95\% CI") 


****************************************************************
***** Table 5: EFFECTS OF CANDIDATE CHARACTERISTICS       ******
****************************************************************

eststo clear
set more off

* store adjusted p-values
 wyoung pacceptinterview pacceptjoboffer ppassinterview  phire interview, ///
 cmd(areg OUTCOMEVAR cf cbl ce cb $screener_ctrl, r cluster(screenerid) a(hiringmanagerid)) cluster(screenerid) ///
 familyp(cf cbl ce cb) bootstraps(1000) seed(123) 
	
 mat b = r(table)
 
local i = 0 // Treatmennt counter
local j = 0 // DV counter
local y_list pacceptinterview pacceptjoboffer ppassinterview  phire interview
foreach y in `y_list' { 

	local ++j
	local i = 1
	
	* hiring manager preferences
	qui reg `y'  cf cbl ce cb  i.hiringmanagerid $screener_ctrl , robust cluster(screenerid)
	qui estimates store `y'
	
	qui sum `y' if cf==0 & cbl==0 & ce==0 & cb==0
	estadd scalar ctrl_mean = r(mean)
	
	qui test cf cbl ce cb
	estadd scalar F_p = r(p)
	
	* Add Westfall-Young p-values
	estadd scalar WYP_cf = b[`=`j'+5*(`i'-1)', 4] //(1,5) (2,5)
	local ++i
	estadd scalar WYP_cbl = b[`=`j'+5*(`i'-1)', 4] //(6,5) (7,5)
	local ++i
	estadd scalar WYP_ce = b[`=`j'+5*(`i'-1)', 4] //(11,5)
	local ++i
	estadd scalar WYP_cb = b[`=`j'+5*(`i'-1)', 4] //(16,5)

	estadd local fe "Manager"
	estadd local ctrl "Screener"
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab  pacceptinterview pacceptjoboffer ppassinterview phire interview     using ../Output/Tables/Table05.tex,  ///
nonumbers title(Hiring manager preferences influence who gets hired)  keep(  cf cbl  ce cb ) $myopts ///
stats(r2 N fe ctrl ctrl_mean F_p WYP_cf WYP_cbl WYP_ce WYP_cb , label("\(R^{2}\)" "Observations" "Fixed effects" "Controls"  "Control mean" "F-test" "WY P-value: Female" "WY P-value: Black" "WY P-value: Elite school" "WY P-value: Big company") )  replace  


****************************************************************
***** Table 6: EFFECTS OF HIRING MANAGER CHARACTERISTICS  ******
****************************************************************

eststo clear
set more off

* store adjusted p-values
 wyoung  pacceptinterview pacceptjoboffer ppassinterview  phire interview, ///
 cmd(areg OUTCOMEVAR hmf hmbl hme hiringmanagerisempty $screener_ctrl, r cluster(screenerid) a(candidateid)) cluster(screenerid) ///
 familyp(hmf hmbl hme hiringmanagerisempty) bootstraps(1000) seed(123) 
	
 mat b = r(table)
 
local i = 0 // Treatmennt counter
local j = 0 // DV counter
local y_list  pacceptinterview pacceptjoboffer ppassinterview  phire interview
foreach y in `y_list' { 

	local ++j
	local i = 1
	
	* hiriing manager characterissticis
	qui reg `y'  hmf hmbl hme hiringmanagerisempty  i.candidateid $screener_ctrl , robust cluster(screenerid)
	qui estimates store `y'
	
	qui sum `y' if hmf==0 & hmbl==0 & hme==0 & hiringmanagerisempty==0
	estadd scalar ctrl_mean = r(mean)
	
	qui test hmf hmbl hme hiringmanagerisempty 
	estadd scalar F_p = r(p)
	
	* Add Westfall-Young p-values
	estadd scalar WYP_hmf = b[`=`j'+4*(`i'-1)', 4] //(1,5) (2,5)
	local ++i
	estadd scalar WYP_hmbl = b[`=`j'+4*(`i'-1)', 4] //(6,5) (7,5)
	local ++i
	estadd scalar WYP_hme = b[`=`j'+4*(`i'-1)', 4] //(11,5)
	local ++i
	estadd scalar WYP_hiringmanagerisempty = b[`=`j'+4*(`i'-1)', 4] //(16,5)

	estadd local fe "Candidate"
	estadd local ctrl "Screener"
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab  pacceptinterview pacceptjoboffer ppassinterview  phire interview using ../Output/Tables/Table06.tex,  ///
nonumbers title(Hiring manager characteristics influence who gets hired)  keep(  hmf hmbl hme hiringmanagerisempty ) $myopts ///
stats(r2 N fe ctrl ctrl_mean F_p WYP_hmf WYP_hmbl WYP_hme WYP_hiringmanagerisempty , label("\(R^{2}\)" "Observations" "Fixed effects" "Controls"  "Control mean" "F-test" "WY P-value: Female" "WY P-value: Black" "WY P-value: Elite school" "WY P-value: Empty") )  replace  

	

**********************************************************************************
***** Table 7:  MATCH-SPECIFIC ANALYSIS ON INTERVIEWS, BY TYPE               *****
***** Table B9: MATCH-SPECIFIC ANALYSIS BY TYPE                              *****
**********************************************************************************

preserve

	foreach y in interview pacceptinterview pacceptjoboffer ppassinterview {
		

		local i = 0

		foreach group in cm cw ce cb hmm hmw hme hiringmanagerisempty { 
			
			local ++i
			qui reg `y' i.match_type $screener_ctrl i.hiringmanagerid i.candidateid if `group'==1, r cluster(screenerid )  noconstant
			qui testparm i.match_type, equal
			local group_`i' = "`group'"
			local p_`y'_`i' = r(p)
			local F_`y'_`i' = round(r(F),.1)
			
			
			
			local ++i 
			reg `y' i.match_type $screener_ctrl i.hiringmanagerid i.candidateid if `group'==0, r cluster(screenerid )  noconstant
			qui testparm i.match_type, equal
			local group_`i' = "not`group'"
			local p_`y'_`i' = r(p)
			local F_`y'_`i' = round(r(F),.1)
		}

	}

	clear
	local I `i'
	set obs `I'
	foreach x in group p_interview F_interview p_pacceptinterview F_pacceptinterview p_ppassinterview F_ppassinterview p_pacceptjoboffer F_pacceptjoboffer  {
		gen `x' = ""
		forv i = 1/`I' {
			replace `x' = "``x'_`i''" in `i'
		}
		destring `x', replace
	}

	* relabel
	gen type = "Candidate"
	replace type = "Hiring manager" if _n>=9

	replace group = "men" if group=="cm"
	replace group = "women" if group=="notcm"
	replace group = "white" if group=="cw"
	replace group = "black" if group=="notcw"
	replace group = "elite" if group=="ce"
	replace group = "non-elite" if group=="notce"
	replace group = "big company" if group=="cb"
	replace group = "small company" if group=="notcb"

	replace group = "men" if group=="hmm"
	replace group = "women" if group=="nothmm"
	replace group = "white" if group=="hmw"
	replace group = "black" if group=="nothmw"
	replace group = "elite" if group=="hme"
	replace group = "non-elite" if group=="nothme"
	replace group = "empty" if group=="hiringmanagerisempty"

	drop if group=="nothiringmanagerisempty"
	texsave * using ../Output/Tables/Appendix/TableB09.tex, replace

	keep group p_interview F_interview type
	texsave * using ../Output/Tables/Table07.tex, replace


restore


****************************************************************
***** Table 8:   CALLBACK DECISIONS AND PREDICTIONS       ******
****************************************************************


 wyoung   , ///
 cmd("regress interview  pacceptinterview pacceptjoboffer ppassinterview $screener_ctrl,  r cluster(screenerid)"   ///
     "regress interview  pacceptinterview pacceptjoboffer ppassinterview $screener_ctrl,  r cluster(screenerid)" ) ///
	 cluster(screenerid)  familyp("pacceptinterview-ppassinterview" "pacceptjoboffer-ppassinterview") bootstraps(1000) seed(123) familypexp
 mat b = r(table)
 
reg interview pacceptinterview ppassinterview pacceptjoboffer $screener_ctrl , robust cluster(screenerid)
	estimates store one_ols
	estadd scalar  p_passacci = b[1, 4]
	estadd scalar  p_passaccj = b[2, 4]
	estadd local s " "
	estadd local phiredecile "No"
 
reg interview ppassinterview pacceptjoboffer $screener_ctrl , robust cluster(screenerid)
	estimates store two_ols
	test ppassinterview-pacceptjoboffer=0
		estadd scalar p_passaccj = r(p)
	estadd local s " "
	estadd local phiredecile "No"
	
reg interview ppassinterview pworkeraccept $screener_ctrl , robust cluster(screenerid)
	estimates store three_ols
	test ppassinterview-pworkeraccept=0
		estadd scalar p_passaccj = r(p)
	estadd local s " "
	estadd local phiredecile "No"

wyoung   , ///
 cmd("regress interview pacceptinterview  pacceptjoboffer ppassinterview i.phire_decile $screener_ctrl, r cluster(screenerid)"   ///
     "regress interview pacceptinterview  pacceptjoboffer ppassinterview i.phire_decile $screener_ctrl, r cluster(screenerid) " ) ///
	 cluster(screenerid)  familyp("pacceptinterview-ppassinterview" "pacceptjoboffer-ppassinterview") bootstraps(1000) seed(123) familypexp
 mat b = r(table)
 
reg interview pacceptinterview ppassinterview pacceptjoboffer i.phire_decile  $screener_ctrl , robust cluster(screenerid)
	estimates store five_ols
	estadd scalar  p_passacci = b[1, 4]
	estadd scalar  p_passaccj = b[2, 4]
	estadd local s " "
	estadd local phiredecile "Yes"




esttab one_ols two_ols three_ols  five_ols  using ../Output/Tables/Table08.tex,     replace $myopts keep(pacceptinterview ppassinterview pacceptjoboffer pworkeraccept )  				  stats(r2 N phiredecile s p_passacci p_passaccj , label("\(R^{2}\)" "Observations" "P(Hire) decile control"  "\hline P-values:" "Pass interview =  Accept interview" "Pass interview = Accept offer" )  fmt(%9.3f 0 %9.3f %9.3f)) 



****************************************************************
***** END OF MAIN TEXT TABLES. START OF APPENDIX TABLES   ******
****************************************************************

  
  
****************************************************************
***** Table 8:   CALLBACK DECISIONS AND PREDICTIONS       ******
****************************************************************





*************************************************************************************
***** Table B1:  IMPACT OF CANDIDATE CHARACTERISTICS ON PROBABILITY RANK       ******
*************************************************************************************

eststo clear
set more off

* store adjusted p-values
 wyoung p1_rank p2_rank p3_rank phire_rank interview, ///
 cmd(areg OUTCOMEVAR cf cbl ce cb $screener_ctrl, r cluster(screenerid) a(hiringmanagerid)) cluster(screenerid) ///
 familyp(cf cbl ce cb) bootstraps(1000) seed(123) 
	
 mat b = r(table)
 
local i = 0 // Treatmennt counter
local j = 0 // DV counter
local y_list p1_rank p2_rank p3_rank phire_rank interview 
foreach y in `y_list' { 

	local ++j
	local i = 1
	
	* hiring manager preferences
	qui reg `y'  cf cbl ce cb  i.hiringmanagerid $screener_ctrl , robust cluster(screenerid)
	qui estimates store `y'
	
	qui sum `y' if cf==0 & cbl==0 & ce==0 & cb==0
	estadd scalar ctrl_mean = r(mean)
	
	qui test cf cbl ce cb
	estadd scalar F_p = r(p)
	
	* Add Westfall-Young p-values
	estadd scalar WYP_cf = b[`=`j'+5*(`i'-1)', 4] //(1,5) (2,5)
	local ++i
	estadd scalar WYP_cbl = b[`=`j'+5*(`i'-1)', 4] //(6,5) (7,5)
	local ++i
	estadd scalar WYP_ce = b[`=`j'+5*(`i'-1)', 4] //(11,5)
	local ++i
	estadd scalar WYP_cb = b[`=`j'+5*(`i'-1)', 4] //(16,5)

	estadd local fe "Manager"
	estadd local ctrl "Screener"
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab  p1_rank p3_rank p2_rank  phire_rank interview     using ../Output/Tables/Appendix/TableB01.tex, ///
nonumbers title(Hiring manager preferences influence who gets hired)  keep(  cf cbl  ce cb ) $myopts ///
stats(r2 N fe ctrl ctrl_mean F_p WYP_cf WYP_cbl WYP_ce WYP_cb , label("\(R^{2}\)" "Observations" "Fixed effects" "Controls"  "Control mean" "F-test" "WY P-value: Female" "WY P-value: Black" "WY P-value: Elite school" "WY P-value: Big company") )  replace  



**********************************************************************************
***** Table B1:  IMPACT OF MANAGER CHARACTERISTICS ON PROBABILITY RANK       *****
**********************************************************************************

eststo clear
set more off

* store adjusted p-values
 wyoung  p1_rank p2_rank p3_rank phire_rank interview, ///
 cmd(areg OUTCOMEVAR hmf hmbl hme hiringmanagerisempty $screener_ctrl, r cluster(screenerid) a(candidateid)) cluster(screenerid) ///
 familyp(hmf hmbl hme hiringmanagerisempty) bootstraps(1000) seed(123) 
	
 mat b = r(table)
 
local i = 0 // Treatmennt counter
local j = 0 // DV counter
local y_list  p1_rank p2_rank p3_rank phire_rank interview
foreach y in `y_list' { 

	local ++j
	local i = 1
	
	* hiriing manager characterissticis
	qui reg `y'  hmf hmbl hme hiringmanagerisempty  i.candidateid $screener_ctrl , robust cluster(screenerid)
	qui estimates store `y'
	
	qui sum `y' if hmf==0 & hmbl==0 & hme==0 & hiringmanagerisempty==0
	estadd scalar ctrl_mean = r(mean)
	
	qui test hmf hmbl hme hiringmanagerisempty 
	estadd scalar F_p = r(p)
	
	* Add Westfall-Young p-values
	estadd scalar WYP_hmf = b[`=`j'+4*(`i'-1)', 4] //(1,5) (2,5)
	local ++i
	estadd scalar WYP_hmbl = b[`=`j'+4*(`i'-1)', 4] //(6,5) (7,5)
	local ++i
	estadd scalar WYP_hme = b[`=`j'+4*(`i'-1)', 4] //(11,5)
	local ++i
	estadd scalar WYP_hiringmanagerisempty = b[`=`j'+4*(`i'-1)', 4] //(16,5)

	estadd local fe "Candidate"
	estadd local ctrl "Screener"
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab  p1_rank p3_rank p2_rank  phire_rank interview     using ../Output/Tables/Appendix/TableB02.tex,  ///
nonumbers title(Hiring manager characteristics influence who gets hired)  keep(  hmf hmbl hme hiringmanagerisempty ) $myopts ///
stats(r2 N fe ctrl ctrl_mean F_p WYP_hmf WYP_hmbl WYP_hme WYP_hiringmanagerisempty , label("\(R^{2}\)" "Observations" "Fixed effects" "Controls"  "Control mean" "F-test" "WY P-value: Female" "WY P-value: Black" "WY P-value: Elite school" "WY P-value: Empty") )  replace  

	
	




*********************************************************************************
***** Table B5:  MATCH SPECIFIC QUALITY                                     *****
***** Figure B1: DISTRIBUTION OF MATCH-TYPE FIXED EFFECTS                   *****
*********************************************************************************

preserve

	* Get R^2, F, and p
	foreach var in interview pacceptinterview ppassinterview pacceptjoboffer {
		qui reg `var' i.match_type $screener_ctrl i.hiringmanagerid i.candidateid, r cluster(screenerid )  noconstant
		dis "Outcome = `var'"
		local r2 = round(`e(r2)',.01)
		dis "R^2 = `r2'"
		qui testparm i.match_type, equal
		local F =  round(`r(F)',.01)
		local p =  round(`r(p)',.01)
		dis "F-stat = `F'"
		dis "p-value = `p'"
		
	}


	* Store b, se, p-value, ci from fixed effects
	foreach y in interview pacceptinterview ppassinterview pacceptjoboffer {
		reg `y' i.match_type $screener_ctrl i.hiringmanagerid i.candidateid, r cluster(screenerid )  noconstant
		matrix A = r(table)
		matrix list A 
		forv i = 1/144 { 
			local b_`y'_`i' =  A[1,`i']
			local se_`y'_`i' =  A[2,`i']
			local p_`y'_`i' = A[4,`i']
			local cil_`y'_`i' = A[5,`i']
			local ciu_`y'_`i' = A[6,`i']
		}
	} 
	* Store match type
	forv i = 1/144 { 
		foreach g in hmw hmm hme hiringmanagerisempty cw cm ce cb {
			qui sum `g' if match_type==`i'
			local `g'_`i' = r(mean)	
		}
	}

	clear
	set obs 144 
	foreach var in b_interview se_interview p_interview cil_interview ciu_interview ///
			b_pacceptinterview se_pacceptinterview p_pacceptinterview cil_pacceptinterview ciu_pacceptinterview ///
			b_ppassinterview se_ppassinterview p_ppassinterview cil_ppassinterview ciu_ppassinterview ///
			b_pacceptjoboffer se_pacceptjoboffer p_pacceptjoboffer cil_pacceptjoboffer ciu_pacceptjoboffer  hmw hmm hme hiringmanagerisempty cw cm ce cb {
		qui gen `var'=""
		forv i = 1/144 {
				qui replace `var' = "``var'_`i''" in `i'
		}
		destring `var', replace
	}

	* Calculator p-value <.05
	foreach y in interview pacceptinterview ppassinterview pacceptjoboffer {
		count if p_`y'<0.05 
	}

	* This completes Table B5. The code below creates Figure B1


	gen hmidentity = ""
	replace hmidentity = "White male" if hmw==1 & hmm==1  
	replace hmidentity = "Black male" if hmw==0 & hmm==1 
	replace hmidentity = "White female" if hmw==1 & hmm==0
	replace hmidentity = "Black female" if hmw==0 & hmm==0  
	replace hmidentity = "Empty" if hiringmanagerisempty==1

	gen cidentity = ""
	replace cidentity = "White male" if cw==1 & cm==1  
	replace cidentity = "Black male" if cw==0 & cm==1 
	replace cidentity = "White female" if cw==1 & cm==0
	replace cidentity = "Black female" if cw==0 & cm==0  

	la var cidentity "Candidate type"
	la var b_interview "Fixed effect"
	graph hbar  b_interview, over(hmidentity, sort(1) descending label(labsize(small))) over(cidentity, sort(1) descending label(labsize(small)))  ytitle("Fixed effect for Interview") graphregion(color(white)) bgcolor(white)  text(-.18 105  "Candidate", color(navy) size(small)) text(-.06 105  "Hiring Manager", color(navy) size(small))
	graph export "../Output/Figures/Appendix/FigureB01.png", replace


restore
  
 
**********************************************************************************
***** Table B6:  HOMOPHILY ACROSS BROAD DEMOGRAPHIC CHARACTERISTICS          *****
**********************************************************************************

foreach var in interview pacceptinterview ppassinterview pacceptjoboffer {
	quietly: reghdfe `var' gender_hom race_hom elite_hom $screener_ctrl, cluster(screenerid ) absorb(hiringmanagerid candidateid)
	estimates store `var'
	lincom gender_hom+race_hom+elite_hom
	estadd scalar p_sum = r(p)
	testparm gender_hom race_hom elite_hom
	estadd scalar p_joint = r(p)
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab interview pacceptinterview ppassinterview pacceptjoboffer  using ../Output/Tables/Appendix/TableB06.tex, $myopts stats(r2 N p_sum p_joint, label(\(R^{2}\) Observations "Sum \$p\$-value" "Joint \$p\$-value")) keep(gender_hom race_hom elite_hom) replace



**********************************************************************************
***** Table B7:  HOMOPHILY ACROSS SPECIFIC DEMOGRAPHICS                      *****
**********************************************************************************

eststo clear

* store adjusted p-values
 wyoung pacceptinterview pacceptjoboffer ppassinterview  phire interview, ///
 cmd(reg OUTCOMEVAR bothmale bothfemale bothelite bothnonelite bothwhite bothblack  i.candidateid i.hiringmanagerid $screener_ctrl, r cluster(screenerid) ) cluster(screenerid) ///
 familyp(bothmale bothfemale bothelite bothnonelite bothwhite bothblack) bootstraps(1000) seed(123) 
	
 mat b = r(table)
 
local i = 0 // Treatmennt counter
local j = 0 // DV counter
local y_list pacceptinterview pacceptjoboffer ppassinterview  phire interview
foreach y in `y_list' { 

	local ++j
	local i = 1
	
	* homophily
	qui reg `y' bothmale bothfemale bothelite bothnonelite bothwhite bothblack i.candidateid i.hiringmanagerid  $screener_ctrl , robust cluster(screenerid)
	qui estimates store `y'
	
	qui test bothmale bothfemale bothelite bothnonelite bothwhite bothblack
	estadd scalar F_p = r(p)
	
	* Add Westfall-Young p-values
	estadd scalar WYP_bm = b[`=`j'+5*(`i'-1)', 4] //(1,5) (2,5)
	local ++i
	estadd scalar WYP_bf = b[`=`j'+5*(`i'-1)', 4] //(6,5) (7,5)
	local ++i
	estadd scalar WYP_be = b[`=`j'+5*(`i'-1)', 4] //(11,5)
	local ++i
	estadd scalar WYP_bn = b[`=`j'+5*(`i'-1)', 4] //(16,5)
	local ++i
	estadd scalar WYP_bw = b[`=`j'+5*(`i'-1)', 4] //(16,5)
	local ++i
	estadd scalar WYP_bb = b[`=`j'+5*(`i'-1)', 4] //(16,5)
	
	estadd local fe "C+HM"
	estadd local ctrl "Screener"
}

global myopts "b(2)  r2 se(2) label prehead(\begin{tabular}{l*{@M}{c}}) postfoot(\end{tabular}) mlabels(, prefix() suffix() depvars) noisily noeqlines nonumbers varlabels(_cons Constant, end("" ) nolast)  starlevels(* 0.1 ** 0.05 *** 0.01)"

esttab pacceptinterview pacceptjoboffer ppassinterview phire  interview     using ../Output/Tables/Appendix/TableB07.tex,  ///
nonumbers title(Hiring manager characteristics influence who gets hired)  keep( bothmale bothfemale bothelite bothnonelite bothwhite bothblack) $myopts ///
stats(r2 N fe ctrl ctrl_mean F_p WYP_bm WYP_bf WYP_be WYP_bn WYP_bw WYP_bb , label("\(R^{2}\)" "Observations" "Fixed effects" "Controls"  "Control mean" "F-test" "WY P-value: Both male" "WY P-value: Both female" "WY P-value: Both Elite School" "WY P-value: Both non-elite school" "WY P-value: Both white " "WY P-value: Both black") )  replace  



**********************************************************************************
***** Table B8:  HOMOPHILY INDEX RESULTS                                     *****
**********************************************************************************

foreach var in interview pacceptinterview ppassinterview pacceptjoboffer {
	quietly: reghdfe `var' hom_index $screener_ctrl i.match_type, cluster(screenerid ) absorb(hiringmanagerid candidateid)
	estimates store `var'
	test hom_index
	estadd scalar p = r(p)
	
}

esttab interview pacceptinterview ppassinterview pacceptjoboffer  using ../Output/Tables/Appendix/TableB08.tex, $myopts stats(r2 N p, label(\(R^{2}\) Observations "\$p\$-value" )) keep(hom_index) replace






























